from PIL import Image
import cv2
import torchvision.transforms as transforms

img_path = './example_img.jpeg'
example_img = Image.open(img_path)
example_img = example_img.convert('RGB')

to_tensor = transforms.ToTensor()
example_tensor = to_tensor(example_img)
print(example_tensor.shape)

cv_img = cv2.imread(img_path)
example_tensor = to_tensor(cv_img)
print(example_tensor.shape)

trans_norm = transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])
img_norm = trans_norm(example_tensor)


example_img = Image.open(img_path)
example_img = example_img.convert('RGB')
transform = transforms.Compose([
    transforms.ToTensor(),
    transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
example_tensor = transform(example_img)
print(example_tensor.shape)
